﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Mask : MonoBehaviour
{

    public int stencilRef = 1;
    public UISprite uISprite;
    public float horizontalSpacing = 0;
    public float verticalSpacing = 0;

    void Start()
    {
        if (uISprite != null)
        {
            Vector3 pos = base.transform.position;
            base.transform.localScale = new Vector3(uISprite.width * 0.95f - horizontalSpacing * 2, uISprite.height * 0.95f - verticalSpacing * 2, 1);
            base.transform.position = new Vector3(uISprite.transform.position.x, uISprite.transform.position.y, pos.z);
        }
        base.gameObject.GetComponent<MeshRenderer>().material.SetInt("_StencilRef", stencilRef);
    }

}
